package com.cdxy.dmr.repository;

import com.cdxy.dmr.dataObject.HotelAttrDO;
import com.cdxy.dmr.mapper.HotelAttrMapper;
import com.cdxy.model.dto.base.mybatis.BaseRepository;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 酒店属性表 服务实现类
 * </p>
 *
 * @author autoGenCode
 * @since 2020-03-05
 */
@Repository
@CacheConfig(cacheNames = "hotel_attr")
public class HotelAttrRepository extends BaseRepository<HotelAttrMapper, HotelAttrDO> {

    /**
     * 查询酒店图片
     *
     * @param hotelId
     * @return
     */
    @Cacheable(key = "#hotelId")
    public List<HotelAttrDO> listByHotelId(Integer hotelId) {
        return this.baseMapper.selectList(this.queryWrapper().eq(HotelAttrDO::getHotelId, hotelId));
    }

}
